#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
# @version: v1.0
# @author : wlisingle
# @Email : 19688513@qq.com
# @Project : g-carbon-bio
# @File : stock_individual.py
# @Software: PyCharm
# @time: 2025/2/19 9:00
# @description : 
"""


class StockIndividual:
    def __init__(self, code: str, name: str, latest_price: float, price_change: float, amplitudes: float,
                 outer_disk: float, inner_disk: float, industry: str, volume_ratio: float,
                 turnover_rate: float, total_turnover_rate: float, volumes_decreasing: bool,
                 rating: str, total_net_inflow_positive: float = 0, total_net_inflow_negative: float = 0):
        self._code = code  # 股票代码
        self._name = name  # 股票名称
        self._latest_price = latest_price  # 最新价格
        self._price_change = price_change  # 涨跌幅
        self._amplitudes = amplitudes  # 振幅
        self._outer_disk = outer_disk  # 外盘
        self._inner_disk = inner_disk  # 内盘
        self._industry = industry  # 行业
        self._volume_ratio = volume_ratio  # 量比
        self._turnover_rate = turnover_rate  # 换手率
        self._total_turnover_rate = total_turnover_rate  # 总换手率
        self._volumes_decreasing = volumes_decreasing  # 成交量减少
        self._rating = rating  # 评级
        self._total_net_inflow_positive = total_net_inflow_positive  # 正净流入总和
        self._total_net_inflow_negative = total_net_inflow_negative  # 负净流入总和

    # Getter 和 Setter 方法
    @property
    def code(self):
        return self._code

    @code.setter
    def code(self, value):
        self._code = value

    @property
    def name(self):
        return self._name

    @name.setter
    def name(self, value):
        self._name = value

    @property
    def latest_price(self):
        return self._latest_price

    @latest_price.setter
    def latest_price(self, value):
        self._latest_price = value

    @property
    def price_change(self):
        return self._price_change

    @price_change.setter
    def price_change(self, value):
        self._price_change = value

    @property
    def amplitudes(self):
        return self._amplitudes

    @amplitudes.setter
    def amplitudes(self, value):
        self._amplitudes = value

    @property
    def outer_disk(self):
        return self._outer_disk

    @outer_disk.setter
    def outer_disk(self, value):
        self._outer_disk = value

    @property
    def inner_disk(self):
        return self._inner_disk

    @inner_disk.setter
    def inner_disk(self, value):
        self._inner_disk = value

    @property
    def industry(self):
        return self._industry

    @industry.setter
    def industry(self, value):
        self._industry = value

    @property
    def volume_ratio(self):
        return self._volume_ratio

    @volume_ratio.setter
    def volume_ratio(self, value):
        self._volume_ratio = value

    @property
    def turnover_rate(self):
        return self._turnover_rate

    @turnover_rate.setter
    def turnover_rate(self, value):
        self._turnover_rate = value

    @property
    def total_turnover_rate(self):
        return self._total_turnover_rate

    @total_turnover_rate.setter
    def total_turnover_rate(self, value):
        self._total_turnover_rate = value

    @property
    def volumes_decreasing(self):
        return self._volumes_decreasing

    @volumes_decreasing.setter
    def volumes_decreasing(self, value):
        self._volumes_decreasing = value

    @property
    def rating(self):
        return self._rating

    @rating.setter
    def rating(self, value):
        self._rating = value

    @property
    def total_net_inflow_positive(self):
        return self._total_net_inflow_positive

    @property
    def total_net_inflow_negative(self):
        return self._total_net_inflow_negative

    def __str__(self):
        # 计算净值
        net_value = self.total_net_inflow_positive + self.total_net_inflow_negative
        return (f"代码: {self.code}, 名称: {self.name}, 最新价: {self.latest_price}, 涨跌幅: {self.price_change}, "
                f"振幅: {self.amplitudes}, 外盘: {self.outer_disk}, 内盘: {self.inner_disk}, "
                f"行业: {self.industry}, 量比: {self.volume_ratio}, "
                f"换手率: {self.turnover_rate}, 总换手率: {self.total_turnover_rate}, "
                f"成交量递减: {self.volumes_decreasing}, 评级: {self.rating}, "
                f"净值: {net_value}")

